UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9LAE1QPNtVUzMq3WSGEkNeF6ID7CHqdfEuvST32OQI='
WHERE
key_id = '46a386a63f7a0ad4ac2755d117ef7e75e22edf7a5f9ef9f77fe30bba4cef5985'
AND (
token = 'f9LAE1QPNtVUzMq3WSGEkNeF6ID7CHqdfEuvST32OQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)