UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XdC6JiVVFhpQajkEzMSB0qvzBI/kvWUITEEgoNJyAes=' 
WHERE 
  key_id = 'eb3716d3c460d86a261f38d8c74da1fe29fbf036dfec5a1fadf460ceeb992fcf' 
  AND (
    token = 'XdC6JiVVFhpQajkEzMSB0qvzBI/kvWUITEEgoNJyAes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040