UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S4MKcDhVi+xCO9i/q+ehv0oMdK4Myeu77U3TPA5qJj0='
WHERE
key_id = 'ebb18d0dc9b87905ab734b4b39f0e13a97246bf10c380c39c6f871ade89df516'
AND (
token = 'S4MKcDhVi+xCO9i/q+ehv0oMdK4Myeu77U3TPA5qJj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)