UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSID3wYx9amynEcgABEcjqyR1n/szn4DQLq6Lr73Ujs=' 
WHERE 
  key_id = '79c816bb6aa9a9202751a7db2041ba9c1515fc724aa720f9da5efdad57566ad1' 
  AND (
    token = 'CSID3wYx9amynEcgABEcjqyR1n/szn4DQLq6Lr73Ujs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030