UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bYL0f1xlz5gQmXeVeiARSi7YOlA84Q9wyuqwEh01VA4='
WHERE
key_id = '962a07e3428845853eb2e987ccf74b9153a28642803ec654e12dcca6cafc5410'
AND (
token = 'bYL0f1xlz5gQmXeVeiARSi7YOlA84Q9wyuqwEh01VA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)