UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YK97fzdbRpx/alfUUywW1GrzetYtzQcxAVUiwjpev1U='
WHERE
key_id = 'c7e44401749892ea440ff9022bbbacb31645585c65c56ddebf0510aafef00bd0'
AND (
token = 'YK97fzdbRpx/alfUUywW1GrzetYtzQcxAVUiwjpev1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)