UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o6VJeiqRagy3a7mkqfKIgAcqxgxsjCm7UfBl089W4hw='
WHERE
key_id = '368791b7ea4f75ecfff7953ad9ee1a58a48775d77bb5af4285b04a3bc46b49cb'
AND (
token = 'o6VJeiqRagy3a7mkqfKIgAcqxgxsjCm7UfBl089W4hw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)