UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PyMhZyzFaQaf81cym0golrf4pncWuKYVeE+WjiyHXC4='
WHERE
key_id = 'dafd36e1446a03a1946b8e5d2772c05cccd15ec2a093a9986e5c7a1321b35e40'
AND (
token = 'PyMhZyzFaQaf81cym0golrf4pncWuKYVeE+WjiyHXC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)