UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gQ6LC5Lof7D0a91tPAHbIyle6jvYasxzjhguWRhE914=' 
WHERE 
  key_id = '94de12495e6b1a970414cba9b76fad6b2745fde1a29a8ae9ab8c22c08d29ab89' 
  AND (
    token = 'gQ6LC5Lof7D0a91tPAHbIyle6jvYasxzjhguWRhE914=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045