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