UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KCoCd7V2lN/8ZUyfDCDSx7sWzincJ3AAWcrEGCTq73Y=' 
WHERE 
  key_id = '655d5129e7e29b383e58d19f11e0109b07e5692fbb36e295b6f319c2a82ea3cb' 
  AND (
    token = 'KCoCd7V2lN/8ZUyfDCDSx7sWzincJ3AAWcrEGCTq73Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035