UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dEBp3Tlurros55txTwHgB7YJrMW6a2Hu2RW9XGVVre8='
WHERE
key_id = 'e289ca365a2ee13013c88eba38f660b1f9f733de4ecf9230ed34f027f066c1e0'
AND (
token = 'dEBp3Tlurros55txTwHgB7YJrMW6a2Hu2RW9XGVVre8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)