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