UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZzMPJJBwNjxufWiaaEV27hmsqxt+QURAcIDL0BODJM=' 
WHERE 
  key_id = 'afa8343d07f72f14b5e4685f39dd0eda2c74b904629ba96d8349fe7acca4db09' 
  AND (
    token = 'gZzMPJJBwNjxufWiaaEV27hmsqxt+QURAcIDL0BODJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024