UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uoc8Idu0PG7yE20DiwtjxYvitQa32Vu2tdDMycng1pA='
WHERE
key_id = '6a74998f447ca6e46258c8353b5959edbe25b8093d7c9cc2343b925c0f0f7ccf'
AND (
token = 'uoc8Idu0PG7yE20DiwtjxYvitQa32Vu2tdDMycng1pA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)