UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c2v2vrJMHZ7uEEapt2A087m/sXQtvnNtHAXvO6GUBow=' 
WHERE 
  key_id = '9711bb33f5e7f6c3073f9373f26c55bd7f46faa070ecc9030ebfe9d157a53a1a' 
  AND (
    token = 'c2v2vrJMHZ7uEEapt2A087m/sXQtvnNtHAXvO6GUBow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032