UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ddFtiZC8AzKBb5pcWJ2Or0yng1L5SvQC9oeYAkwoNUw='
WHERE
key_id = '41022331032fb74ae888298cb3a69a324ae37fdb7b62b51d9795b1f52c354ef1'
AND (
token = 'ddFtiZC8AzKBb5pcWJ2Or0yng1L5SvQC9oeYAkwoNUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)