UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kKD1Gye52BJTdErhbRKZ82pmLxGfyiYDAtFUm3R31r8='
WHERE
key_id = '9d8aaa2c3acaaeb38eedade39338464289592611bc73bf29277b725aa32e88c4'
AND (
token = 'kKD1Gye52BJTdErhbRKZ82pmLxGfyiYDAtFUm3R31r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)