UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XcZuZfqO9WutzL5JdadZijsFMqThq/SJTRLF/fi0rI0='
WHERE
key_id = '9ad96ed45c881adac929112f4950049a415956336b85e1520979f951f3ece2fc'
AND (
token = 'XcZuZfqO9WutzL5JdadZijsFMqThq/SJTRLF/fi0rI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)