UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nW6RJDskGJnjspyjMEdjAQP77sqKbnQmdm6ubS9Qavg='
WHERE
key_id = '8d9a45acf841f2e6b1da3408689a206114d37afc17500d1fc8e9f1fa40a739ca'
AND (
token = 'nW6RJDskGJnjspyjMEdjAQP77sqKbnQmdm6ubS9Qavg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)