UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XzpL3fnMCj3zE7l7d8ItGnXCd6FebkDUdI+SYIuMWw='
WHERE
key_id = '0afd3177f7062b621acceeb83f7a86f4fee0c05308084e4e345177adad289eba'
AND (
token = '0XzpL3fnMCj3zE7l7d8ItGnXCd6FebkDUdI+SYIuMWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)