UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JxQijUKZWocKumZobBFCAyB8SmsGqel2ajotgBHUtsU=' 
WHERE 
  key_id = 'd3a4e11fb00b9f7af894aac4dee97ae0da3b63641f07638d2cb5d75ed73d082b' 
  AND (
    token = 'JxQijUKZWocKumZobBFCAyB8SmsGqel2ajotgBHUtsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016