UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hpzvPNz8ky5qWUZHE2EIXhqvVbA11PeDEkX8DKnLGyo='
WHERE
key_id = '2f1eb64f333c155052bfff998a055577e84d0597e89b054a5f5cef8aebd1c6e5'
AND (
token = 'hpzvPNz8ky5qWUZHE2EIXhqvVbA11PeDEkX8DKnLGyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)