UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uh2N1oZbBWDJTD33xHXU448jDCSUb5glDRb2FNNa2qY=' 
WHERE 
  key_id = '8842c2ea6b744526ac4736dec9160fad800f971f5946b3f9dea363398620c191' 
  AND (
    token = 'uh2N1oZbBWDJTD33xHXU448jDCSUb5glDRb2FNNa2qY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035