UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AQHXIrHJkJL3iJLYWbZW537glrli0hRRLEcVNBDRTio='
WHERE
key_id = '51fa0e53aec5393a807f6b1e8e39cce882b3d75b570fd62f76f7ab66927f7f01'
AND (
token = 'AQHXIrHJkJL3iJLYWbZW537glrli0hRRLEcVNBDRTio='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)