UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L6A+bA+91yTBrYP8xdqIkLA2zckX77Lk+20haZ0URjg='
WHERE
key_id = 'a222e7d033db465a4fdb6978f30a47631d6696cfcf768253fae96f018ff2ea9e'
AND (
token = 'L6A+bA+91yTBrYP8xdqIkLA2zckX77Lk+20haZ0URjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)