UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rkCw4KYohfsLISGY8622qzDgGFbNCgrYV6+iL7k3Ax8='
WHERE
key_id = 'e6e6d04b4d22cd6ab20cbbb3d6a69a305fe0d597d0973cf5594f22eb301a66e7'
AND (
token = 'rkCw4KYohfsLISGY8622qzDgGFbNCgrYV6+iL7k3Ax8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)