UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mi/yKWpkVPDehrhACVEhYFeJ6fYozpg+Ti8x+S/XxTk='
WHERE
key_id = '585571398151f546a13d0b0a1432d0c95ce2bb6679386e6d7cd06a5669f5143f'
AND (
token = 'mi/yKWpkVPDehrhACVEhYFeJ6fYozpg+Ti8x+S/XxTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)