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