UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4rrpeLiWZdFB9JjXLEaC/lAAg9YJd0bjdBppN+cNEQ4='
WHERE
key_id = 'ca9cad024aafd70974836b48b415b9f86a66bd29fb8e8411b37a49655cb8afe1'
AND (
token = '4rrpeLiWZdFB9JjXLEaC/lAAg9YJd0bjdBppN+cNEQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)