UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CjUQY8ssCIywablUW3C6xN6h7Pplpo9YfojEMX1yoE0='
WHERE
key_id = 'ea03260f1bba1ea9ffdfda8d8adfb997d6e614d91435480e994dbdf889250697'
AND (
token = 'CjUQY8ssCIywablUW3C6xN6h7Pplpo9YfojEMX1yoE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)