UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INYnPix1VinWZNdcHzpMMJXoRl5nu9nsw+n5sARSGXk=' 
WHERE 
  key_id = '89d622888ec9c86a434ff6de80b98eb3c8258b766e67420b18e4e0df84171072' 
  AND (
    token = 'INYnPix1VinWZNdcHzpMMJXoRl5nu9nsw+n5sARSGXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026